package com.study.english.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.study.english.pojo.vo.PlStudyPlanVideoTypeVo;
import com.study.english.result.Result;
import com.study.english.service.IPlStudyPlanVideoTypeService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

import com.study.english.domain.PlStudyPlanVideoType;

import org.springframework.web.bind.annotation.*;

/**
 * 学习计划视频类型
 *
 * @author wf
 * @description 针对表【pl_study_plan_video_type(学习计划视频类型)】的数据库操作Controller
 * @createDate 2024-06-27 15:28:53
 */
@RestController
@RequestMapping("plStudyPlanVideoType")
public class PlStudyPlanVideoTypeController {

    @Autowired
    private IPlStudyPlanVideoTypeService plStudyPlanVideoTypeService;


    /**
     * 新增:学习计划视频类型
     */
    @PostMapping("addPlStudyPlanVideoType")
    public Result addPlStudyPlanVideoType(@RequestBody PlStudyPlanVideoTypeVo plStudyPlanVideoTypeVo) {
        plStudyPlanVideoTypeService.addPlStudyPlanVideoType(plStudyPlanVideoTypeVo);
        return Result.success();

    }


    /**
     * 分页查询:学习计划视频类型
     */
    @PostMapping("getPlStudyPlanVideoTypePageList")
    public Result getPlStudyPlanVideoTypePageList(@RequestBody PlStudyPlanVideoTypeVo plStudyPlanVideoTypeVo) {

        IPage<PlStudyPlanVideoTypeVo> page = new Page<>(plStudyPlanVideoTypeVo.getPageNum(), plStudyPlanVideoTypeVo.getPageSize());
        IPage<PlStudyPlanVideoTypeVo> list = plStudyPlanVideoTypeService.getPlStudyPlanVideoTypePageList(page, plStudyPlanVideoTypeVo);
        return Result.success(list);
    }


    /**
     * 不分页查询:学习计划视频类型
     */

    @PostMapping("getPlStudyPlanVideoTypeList")
    public Result getPlStudyPlanVideoTypeList(@RequestBody PlStudyPlanVideoTypeVo plStudyPlanVideoTypeVo) {
        List<PlStudyPlanVideoTypeVo> plStudyPlanVideoTypeVoList = plStudyPlanVideoTypeService.getPlStudyPlanVideoTypeList(plStudyPlanVideoTypeVo);

        return Result.success(plStudyPlanVideoTypeVoList);
    }

    /**
     * 根据id查询详情:学习计划视频类型
     */

    @GetMapping("getPlStudyPlanVideoTypeById")
    public Result getPlStudyPlanVideoTypeById(@RequestParam Long id) {
        PlStudyPlanVideoTypeVo plStudyPlanVideoType = plStudyPlanVideoTypeService.getPlStudyPlanVideoTypeById(id);
        return Result.success(plStudyPlanVideoType);
    }

    /**
     * 根据id删除:学习计划视频类型
     */
    @GetMapping("delPlStudyPlanVideoType")
    public Result delPlStudyPlanVideoType(@RequestParam Long id) {
        plStudyPlanVideoTypeService.delPlStudyPlanVideoType(id);
        return Result.success();
    }


    /**
     * 修改:学习计划视频类型
     */
    @PostMapping("updatePlStudyPlanVideoType")
    public Result updatePlStudyPlanVideoType(@RequestBody PlStudyPlanVideoTypeVo plStudyPlanVideoTypeVo) {
        plStudyPlanVideoTypeService.updatePlStudyPlanVideoType(plStudyPlanVideoTypeVo);
        return Result.success();

    }
}
